<?php /* Smarty version 2.6.20, created on 2016-04-13 14:06:04
         compiled from sendtpl.htm */ ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>发货单模板</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="admin.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../script/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="../script/jquery.ui.js"></script>
<script type="text/javascript" src="../script/dialog/dialog.js" id="dialog_js"></script>
</head>
<body>
<div class="container">
    <div class="flow">
        <div class="itemtitle">
            <h3>发货单模板</h3>
            <ul>
                <li <?php if ($_GET['operation'] == ''): ?>class="current"<?php endif; ?>><a href="?m=<?php echo $_GET['m']; ?>
&s=<?php echo $_GET['s']; ?>
"><span>管理</span></a></li>
				<?php if ($_GET['operation'] == 'edit'): ?>
                <li class="current"><a href="#"><span>修改</span></a></li>
                <?php endif; ?>
            </ul>
		</div>
    </div>
    <div class="h35"></div>
    <script type="text/javascript">
    $(function(){
        /* 全选 */
         $('.checkall').click(function(){
            var _self = this;
            $('.checkitem').each(function(){
                if (!this.disabled)
                {
                    $(this).attr('checked', _self.checked);
                }
            });
            $('.checkall').attr('checked', this.checked);
        });	 
    });
    </script>
	<?php if ($_GET['operation'] == 'add' || $_GET['operation'] == 'edit'): ?>
    <form name="form" id="form" method="post">
        <input name="id" type="hidden" id="id" value="<?php echo $this->_tpl_vars['de']['id']; ?>
">
        <table class="table">
            <thead>
                <tr>
                    <th class="partition" colspan="99">发货单模板</th>
                </tr>
            </thead>
            <tbody>
            <tr>
                <td width="100">名称</td>
                <td>
				<input name="title" type="text" id="title" class="w350" value="<?php echo $this->_tpl_vars['de']['title']; ?>
"/>
                <div id="form-error" class="form-error"></div>
                </td>
            </tr>
            <tr>
                <td>类型</td>
                <td>
                <?php if ($this->_tpl_vars['de']['type'] == 1): ?>客户联<?php endif; ?>
                <?php if ($this->_tpl_vars['de']['type'] == 2): ?>库房联<?php endif; ?>
                <?php if ($this->_tpl_vars['de']['type'] == 3): ?>财务联<?php endif; ?>
                </td>
            </tr>
            <tr>
                <td width="100">详细介绍</td>
                <td>
        <script charset="utf-8" src="<?php echo $this->_tpl_vars['config']['weburl']; ?>
/lib/kindeditor/kindeditor-min.js"></script>
				<script>
                var editor;
                KindEditor.ready(function(K) {
                    editor = K.create('textarea[name="content"]', {
                        resizeType : 1,
                        langType :'<?php echo $this->_tpl_vars['config']['language']; ?>
'
                    });
                });
                </script>
                <textarea style="width:80%; height:300px" name="content"><?php echo $this->_tpl_vars['de']['sendtpl']; ?>
</textarea>
                </td>
            </tr>
            <tr>
                <td>&nbsp;</td>
                <td>
                <input class="submit" type="submit" value="提交">
                <input name="act" type="hidden" id="action" value="edit">
               
                </td>
            </tr>
            </tbody>
        </table>
        </form>
    <?php else: ?>
    <form action="" method="post" id="form" name="form">
    <input type="hidden" name="act" value="op" />
    <table class="table">
        <thead>
        <tr>
            <th colspan="99" class="partition">
            <ul class="button">
                <li class="button">
                    <a class="a_button" id="open" href="javascript:void();">安装</a>
                </li>
                
                <li class="button">
                    <a class="a_button" id="close" href="javascript:void();">卸载</a>
                </li>
                
                <li class="button">
                    <a class="a_button" id="printAll" href="javascript:void();">合并打印预览</a>
                </li>
            </ul>
            </th>
        </tr>
        </thead>
        <tbody>
            <tr class="header">
                <th width="10" class="pl20"><input type="checkbox" class="checkall"></th>
                <th width="255" class="ac">操作</th>
                <th width="150">名称</th>
                <th class="ac">类型</th>
                <th class="ac" width="60">是否安装</th>
            </tr>
            <?php $_from = $this->_tpl_vars['re']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['list']):
?>
            <tr>
                <td class="pl20"><input type="checkbox" value="<?php echo $this->_tpl_vars['list']['id']; ?>
" class="checkitem" name="chk[]"></td>
                <td class="ac">
                <a href="#" data_type="print" data_id="<?php echo $this->_tpl_vars['list']['id']; ?>
">打印预览</a>
                <a href="module.php?m=logistics&s=sendtpl.php&operation=edit&editid=<?php echo $this->_tpl_vars['list']['id']; ?>
">编辑</a>
                </td>
                <td><?php echo $this->_tpl_vars['list']['title']; ?>
</td>
                <td class="ac"><?php if ($this->_tpl_vars['list']['type'] == 1): ?>客户联<?php elseif ($this->_tpl_vars['list']['type'] == 2): ?>库房联<?php elseif ($this->_tpl_vars['list']['type'] == 3): ?>财务联<?php endif; ?></td>
                <td class="ac"><?php if ($this->_tpl_vars['list']['status'] == 1): ?>安装<?php else: ?>卸载<?php endif; ?></td>
                
            </tr>
            <?php endforeach; else: ?>
            <tr>
                <td class="norecord" colspan="99"><i></i><span>暂无符合条件的数据记录</span></td>
            </tr>
            <?php endif; unset($_from); ?>
        </tbody>
    </table>
    </form>
    <?php endif; ?>
</div>
<script>
    $(".a_button").click(function () {
        var obj=$("input[type='checkbox']:checked");
        if(!obj.length)
        {
            alert('对不起，请选择数据，再进行操作!');
            return false;
        }
        if(this.id=='close'){
        	if(!confirm('卸载后模板内容将初始化！！！')){
        		return false;
        	}
        }
        if(this.id=='printAll'){
        	$('input[name="act"]').val('print');
        	window.parent.iframe_form("sendtpl", '发货单打印预览', '<?php echo $this->_tpl_vars['config']['weburl']; ?>
/admin/module.php?m=logistics&s=sendtpl.php&'+$("#form").serialize(), 850,500);
        	return false;
        }
        $('input[name="act"]').val((this.id));
        $("#form")[0].submit();
        return false;
    });
    
    $('a[data_type="print"]').bind('click',function(){
    	window.parent.iframe_form("sendtpl", '发货单打印预览', '<?php echo $this->_tpl_vars['config']['weburl']; ?>
/admin/module.php?m=logistics&s=sendtpl.php&act=print&id='+$(this).attr('data_id'), 850,500);
	});
    </script>  
</body>
</html>